package com.hpeu_01.day0107.homework;

import lombok.Data;

/**
 * 2.定义一个类是员工,员工有id和name属性（私有）,有一个抽象方法是work,不同的员工工作的内容不同；
 *  再定义3个类,程序员, 老师,网管,分别继承员工类再分别调用work的时候输出以下格式：
 *  id为xx的name写代码。
 * id为xx的name讲课。
 * id为xx的name拉网线。
 */
@Data
public abstract class Employee {
    private int id;//员工的id
    private String name;//员工的名字

    public Employee(int id, String name) {
        this.id = id;
        this.name = name;
    }

    public abstract void work();//定义抽象方法work

}
//程序员类
class Programmer extends Employee{
    public Programmer(int id, String name) {
        super(id, name);
    }

    @Override
    public void work() {
        System.out.println("id为"+this.getId()+"的"+this.getName()+"写代码");
    }
}
//老师类
class Teacher extends Employee{
    public Teacher(int id, String name) {
        super(id, name);
    }

    @Override
    public void work() {
        System.out.println("id为"+this.getId()+"的"+this.getName()+"讲课");
    }
}
//网管类
class NetWork extends Employee{
    public NetWork(int id, String name) {
        super(id, name);
    }

    @Override
    public void work() {
        System.out.println("id为"+this.getId()+"的"+this.getName()+"拉网线");
    }
}
class EmployeeDome{
    public static void main(String[] args) {
        Programmer programmer = new Programmer(111,"程序员");
        programmer.work();
        System.out.println();
        Teacher teacher = new Teacher(222,"老师");
        teacher.work();
        System.out.println();
        NetWork netWork = new NetWork(333,"网管");
        netWork.work();
    }
}